﻿
CREATE VIEW [dbo].[AmixViewRegistru]
AS
SELECT     dbo.AmixRegistru.NrInventar, dbo.AmixRegistru.Denumire, dbo.AmixRegistru.ContAmortizare, dbo.AmixCatalog.Cod, dbo.AmixRegistru.DataIntrare, 
                      dbo.AmixRegistru.DataIesire, dbo.AmixRegistru.CodUnitate, dbo.Departamente.Nume, dbo.AmixRegistru.ContImobilizare, dbo.AmixRegistru.ContCheltuiala, 
                      dbo.AmixRegistru.DurataAmortizare, dbo.AmixRegistru.RegimAmortizare, COALESCE (dbo.AmixAmortizare.ValoareInventar, dbo.AmixRegistru.ValoareInventar) 
                      AS ValoareInventar, COALESCE (dbo.AmixAmortizare.ValoareAmortizata, dbo.AmixRegistru.ValoareInventar) AS ValoareAmortizata, 
                      COALESCE (dbo.AmixAmortizare.ValoareRamasa, 0) AS ValoareRamasa, dbo.AmixAmortizare.AmortizareLuna, dbo.AmixAmortizare.DurataNormata, 
                      dbo.AmixAmortizare.LuniAmortizate, dbo.AmixTipStare.Denumire AS Stare, COALESCE (dbo.AmixAmortizare.Luna, 0) AS Luna, COALESCE (dbo.AmixAmortizare.An, 0) 
                      AS An, dbo.AmixRegistru.Blocat, dbo.AmixRegistru.Compus, COALESCE (dbo.AmixAmortizare.Blocat, 0) AS AmortizareBlocata, dbo.AmixRegistru.IDMijlocFix, 
                      dbo.AmixGestionari.Nume AS Gestionar, dbo.AmixRegistru.IDStare, dbo.AmixRegistru.StocFaptic, dbo.AmixRegistru.Categorie, dbo.AmixCatalog.Grupa, 
                      dbo.Departamente.IDDepartament, dbo.AmixRegistru.ContTransferForSuperior, dbo.AmixRegistru.ValoareIntrataTransfer, dbo.Jurnale.Codificare, 
                      dbo.AmixRegistru.ContTransfer, dbo.AmixRegistru.IDSursaFinantare,dbo.SurseFinantare.Denumire AS SursaFinantare
FROM         dbo.AmixRegistru LEFT OUTER JOIN
                      dbo.SurseFinantare ON dbo.AmixRegistru.IDSursaFinantare = dbo.SurseFinantare.IDSursaFinantare LEFT OUTER JOIN
                      dbo.Jurnale ON dbo.AmixRegistru.IDJurnal = dbo.Jurnale.IDJurnal LEFT OUTER JOIN
                      dbo.AmixAmortizare ON dbo.AmixAmortizare.IDMijlocFix = dbo.AmixRegistru.IDMijlocFix LEFT OUTER JOIN
                      dbo.AmixCatalog ON dbo.AmixRegistru.IDClasificare = dbo.AmixCatalog.IDClasificare LEFT OUTER JOIN
                      dbo.Departamente ON dbo.AmixRegistru.IDDepartament = dbo.Departamente.IDDepartament LEFT OUTER JOIN
                      dbo.AmixTipStare ON dbo.AmixRegistru.IDStare = dbo.AmixTipStare.IDStare LEFT OUTER JOIN
                      dbo.AmixGestionari ON dbo.AmixRegistru.IDGestionar = dbo.AmixGestionari.IDGestionar